<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:include="_meta :: header">
    <title>列表</title>
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">列表</a>
            <a>
              <cite>管理</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="float: right;height: 30px;line-height: 30px;margin-top: 5px;" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form action="#" class="layui-form layui-col-space5" th:action="@{/myVacation/tVacation}" method="post">
                        <div class="layui-inline ">
                            <select name="tVacationStatus" id="tVacationStatus" class="layui-input">
                                <option value="">搜索假期状态</option>
                                <option value="0">未开始</option>
                                <option value="1">进行中</option>
                                <option value="2">已开始</option>
                            </select>
                        </div>
                        <div class="layui-inline ">
                            <select name="verifyStatus" id="verifyStatus" class="layui-input">
                                <option value="">搜索审核状态</option>
                                <option value="0">不准假</option>
                                <option value="1">准假</option>
                            </select>
                        </div>
                        <div class="layui-inline ">
                            <select name="isVerified" id="isVerified" class="layui-input">
                                <option value="">搜索是否审核完毕</option>
                                <option value="0">未审核</option>
                                <option value="1">已审核</option>
                            </select>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn  layui-btn-success radius"><i class="layui-icon">&#xe615;</i>
                            </button>
                            <a href="javascript:;"
                               onclick="layer_show('请假','/myVacation/tVacation/addBefore',432,500)"
                               class="layui-btn  layui-btn-normal radius"><i class="layui-icon">&#xe600;</i> 我要请假
                            </a>
                        </div>
                        <div class="layui-card-body" style="text-align: center">
                            <table class="layui-table layui-form">
                                <thead>
                                <tr class="text-c">
                                    <th width="25">序号</th>
                                    <th width="40">请假人编号</th>
                                    <th width="40">请假原因</th>
                                    <th width="40">开始时间</th>
                                    <th width="40">结束时间</th>
                                    <th width="40">假期状态</th>
                                    <th width="40">是否准假</th>
                                    <th width="40">是否审核完毕</th>
                                    <th width="40">提交请假时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="text-c" th:if="${pageInfo.list.size() == 0}">
                                    <td colspan="15"><strong>暂无数据</strong></td>
                                </tr>
                                <tr class="text-c" th:each="tVacation,count:${pageInfo.list}">
                                    <td th:text="${count.count}"></td>
                                    <td th:text="${tVacation.userId}"></td>
                                    <td th:text="${tVacation.reason}"></td>
                                    <td th:text="${#temporals.format(tVacation.startTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                    <td th:text="${#temporals.format(tVacation.endTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                    <td th:if="${tVacation.VacationStatus} == 0" th:text="未开始" style="color: red"></td>
                                    <td th:if="${tVacation.VacationStatus} == 1" th:text="进行中" style="color: blue"></td>
                                    <td th:if="${tVacation.VacationStatus} == 2" th:text="已开始" style="color: green"></td>
                                    <td th:if="${tVacation.verifyStatus} ==0" th:text="不准假" style="color:red;"></td>
                                    <td th:if="${tVacation.verifyStatus} ==1" th:text="准假" style="color:green;"></td>
                                    <td th:if="${tVacation.isVerified} ==0" th:text="未审核" style="color:red;"></td>
                                    <td th:if="${tVacation.isVerified} ==1" th:text="已审核" style="color:green;"></td>
                                    <td th:text="${#temporals.format(tVacation.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <div th:include="_pagination :: page"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs">
</div>
<!--/_footer 作为公共模版分离出去-->
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var form = layui.form;
        $("#vacationStatus").val([[${searchInfo.vacationStatus}]]);
        $("#verifyStatus").val([[${searchInfo.verifyStatus}]]);
        $("#isVerified").val([[${searchInfo.isVerified}]]);
        form.render();
        // 监听全选
        form.on('checkbox(checkall)', function(data){

            if(data.elem.checked){
                $('tbody input').prop('checked',true);
            }else{
                $('tbody input').prop('checked',false);
            }
            form.render('checkbox');
        });
        form.on('select(selectchange)', function(data){
            console.log(data.value); //得到被选中的值
            var pageNo = $('#pageNo');
            var Form = $('form')
            pageNo.val(1);
            Form.submit();
            form.render('select');
        });
        //日期时间范围选择
        laydate.render({

        });
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this
                ,type: 'datetime'
                ,range: true //或 range: '~' 来自定义分割字符
            });
        });
    });


</script>
</body>
</html>